import { createRouter, createWebHistory } from "vue-router";

const routes = [
    //任務大廳
    {
        path:"/",
        redirect:"/home",
        meta:{
            title:'通报平台'
        }
    },
    {
        path: "/login",
        name: "login",
        component: () => import("../views/login.vue"),
    },
    {
        path: "/register",
        name: "register",
        component: () => import("../views/register.vue"),
    },
    {
        path: "/forgetPwd",
        name: "forgetPwd",
        component: () => import("../views/forgetPwd.vue"),
    },
    {
        path: "/",
        name: "home",
        component: () => import("../views/home/index.vue"),
        children:[
            {
                path:'/home',
                component: () => import("../views/home/disktop/index.vue"),
            },{
                path:'/inspection',
                name:'inspection',
                component:() => import("../views/home/inspection/index.vue"),
            },{
                path:'/inspectionDtl/:id',
                name:'inspectionDtl',
                component:() => import("../views/home/inspection/dtl.vue"),
            },{
                path:'/NewManagement',
                name:'单位管理 / 新增单位',
                component:() => import("../views/home/Management/new.vue"),
            },{
                path:'/Management',
                name:'单位管理',
                component:() => import("../views/home/Management/index.vue"),
            },{
                path:'/ManagementDtl/:id',
                name:'ManagementDtl',
                component:() => import("../views/home/Management/dtl.vue"),
            },{
                path:'/Logs',
                name:'操作日志',
                component:() => import("../views/home/Log/index.vue"),
            },{
                path:'/LogsDtl/:id',
                name:'操作日志详情',
                component:() => import("../views/home/Log/dtl.vue"),
            },{
                path:'/admin',
                name:'admin',
                component:() => import("../views/home/system/admin.vue"),
            },{
                path:'/role',
                name:'role',
                component:() => import("../views/home/system/role.vue"),
            },{
                path:'/bugMgmt',
                name:'bugMgmt',
                component:() => import("../views/home/bugMgmt/index.vue"),
            },{
                path:'/bugMgmtDtl',
                name:'bugMgmtDtl',
                component:() => import("../views/home/bugMgmt/dtl.vue"),
            },{
                path:'/tongbao',
                name:'tongbao',
                component:() => import("../views/home/tongbao/index.vue"),
            }
        ]
    },
];

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes,
    scrollBehavior() {
        return { x: 0, y: 0 };
    },
});

export default router;
